/*
 * CEvent.java
 *
 * Copyright (c) 2009 Giles Millward (Manigra). All rights reserved.
 *
 * This file is part of JRogueDPS.
 *
 * JRogueDPS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JRogueDPS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with JRogueDPS.  If not, see <http://www.gnu.org/licenses/>.
 */
package dpssystem;

import java.util.ArrayList;

/**
 *
 * @author gmillward
 */
public abstract class CEvent implements Comparable {

    private double m_eventTime;

    CEvent(double p_eventTime)
    {
        m_eventTime = p_eventTime;
    }
    
    // Implement this for what event is needed
    public abstract ArrayList<CEvent> runEvent(CSim p_sim);

    public double getEventTime() {
        return m_eventTime;
    }

    // Comparator for sort (by event time then by priority)
    public int compareTo(Object anotherEvent) throws ClassCastException {

        double l_timeDelta = this.m_eventTime - ((CEvent) anotherEvent).getEventTime();
        if (l_timeDelta < 0)
        {
            return -1;
        } 
        else if (l_timeDelta > 0)
        {
            return 1;
        }

        return 0;
    }
}
